﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ManAndTV
{
    public class TV
    {             
        public Control control = new Control();
        Renderer display = new Renderer();
        

        private bool _Power;
        private int _ChanelNumber = 1;
        private int _Volume = 0;

        public void Power()
        {            
            _Power = !_Power;

            if (!_Power)
            {
                display.DrawDislpay();
            }
            else
            {
                display.DrawChanelNumber(_ChanelNumber);
            }
        }

        public void ChangeChanelForward()
        {
            if(!_Power)
            {
                return;
            } 

            if (_ChanelNumber == 100)
            {
                return;
            }

            _ChanelNumber++;

            display.DrawChanelNumber(_ChanelNumber);
        }

        public void ChangeChanelBack()
        {
            if (!_Power)
            {
                return;
            }

            if (_ChanelNumber == 1)
            {
                return;
            }

            _ChanelNumber--;

            display.DrawChanelNumber(_ChanelNumber);
        }

        public void ChangeChanelToEnteringNumber(int chanelNumber)
            {
                if (!_Power)
                {
                    return;
                }

                _ChanelNumber = chanelNumber;

                display.DrawChanelNumber(_ChanelNumber);

            }

        public void IncreaseVolume()
        {
            if (!_Power)
            {
                return;
            }

            if (_Volume == 11)
            {
                return;
            }

            _Volume++;

            display.DrawVolumeBar(_Volume);

        }

        public void DecreaseVolume()
        {
            if (_Volume < 0)
            {
                return;
            }

            if (!_Power)
            {
                return;
            }

            _Volume--;
            display.DrawVolumeBar(_Volume);

        }
    }
}